<template>
	<div>
		<template v-for="(item, index) in options">
			<template v-if="values.includes(item.value || item)">
				<span :key="item.value" v-if="item.showClass == '' || item.showClass == 'default'">{{ item.label || item }} </span>
				<el-tag v-else :key="index * 2" :index="index" :type="item.showClass" :disable-transitions="true">{{ item.label || item }}</el-tag>
			</template>
		</template>
	</div>
</template>

<script setup lang="ts" name="dict-tag">
import { computed } from 'vue';
const props = defineProps({
	options: {
		type: Array as any,
		default: null,
	},
	value: [String, Array],
});

const values = computed(() => {
	if (props.value != null && props.value !== 'undefined') {
		return Array.isArray(props.value) ? props.value : [props.value];
	} else {
		return [];
	}
});
</script>

<style scoped></style>
